package com.example.demo.redis.rediscontroller;

import com.example.demo.model.Material;
import com.example.demo.redis.service.RedisZhuJieService;
import com.example.demo.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by Administrator on 2018/12/28.
 */
@RestController
public class RedisZhuJieController {

    @Autowired
    private RedisZhuJieService redisZhuJieService;
    @GetMapping("queryZhuJieMaterial")
    public Result<List<Material>> queryZhuJieMaterial(){

        return redisZhuJieService.queryZhuJieMaterial();
    }
    @PostMapping("updateZhuJieMaterial")
    public Result<List<Material>> updateZhuJieMaterial(@RequestBody Material material){

        return redisZhuJieService.updateZhuJieMaterial(material);
    }
    @GetMapping("deleteZhuJieMaterial")
    public String deleteZhuJieMaterial(@RequestParam Integer id){
        redisZhuJieService.deleteZhuJieMaterial(id);
        return "删除成功";
    }

    @PostMapping("insertZhuJieMaterial")
    public Material insertZhuJieMaterial(@RequestBody Material material){

        return redisZhuJieService.insertZhuJieMaterial(material);
    }
}
